package com.ruijiang.mapper.VmServiceMapper;

import com.ruijiang.dto.insert.PolicyInsertDto;
import com.ruijiang.dto.page.PagePolicyDto;
import com.ruijiang.entity.Policy;
import com.ruijiang.vo.policy.PolicyVMVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface PolicyMapper {


    List<Policy> getList(PagePolicyDto dto);

    @Delete("delete from tb_policy where policy_id = #{policyId}")
    void deletePolicyById(String policyId);


    void insertPolicy(PolicyInsertDto dto);

    /**
     * 查询售货机策略
     * @param innerCode
     * @return
     */
    PolicyVMVO getPolicyByInnerCode(String innerCode);

    /**
     * 修改策略
     * @param policyId
     * @param dto
     */
    @Update("update tb_policy set policy_name = #{dto.policyName},discount = #{dto.discount} where policy_id = #{policyId}")
    void updatePolicyById(String policyId, PolicyInsertDto dto);
}
